/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import type { FC } from 'react';
import { View, StyleSheet, Text } from 'react-native';
import Icon from '../Icon';
import type { IconProps } from '../Icon';

/** header组件入参 */
type HeaderProps = {
  /** 标题 */
  title: string;
  /** icon */
  icon: IconProps;

  colorScheme: 'light' | 'dark';
}

/**
 * @description 首页顶部Header组件
 * @param HeaderProps 
 * @returns 
 */
const Header: FC<HeaderProps> = ({
  title,
  icon,
  colorScheme
}) => {
  return (
    <View style={styles.container}>
      <Text style={[styles.text, { color: colorScheme === 'dark' ? '#fff' : '#000' }]}>{title}</Text>
      <Icon {...icon} />
    </View>
  )
}

const styles = StyleSheet.create({
  container: {
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
    paddingVertical: 10.5
  },
  text: {
    fontFamily: 'HarmonyHeiTi',
    fontSize: 26,
    fontWeight: '600',
    lineHeight: 35,
    color: 'rgba(0, 0, 0, 0.9)'
  }
})

export default Header;
